import React from "react";

const Math = (props) => {
    
    const handleClick = () => {
        // 调用API，往编辑器中插入一个数字
        props.editor.insertText(
            "```katex\n" + 
            "E = mc^2\n```\n\n" + 
            "<p>更多公式请参考 <a href=\"http://katex.org/\" target=\"_blank\">katex</a>。</p>"
        );
    }

    return (
        <span
        className="button button-type-counter"
        title="公式"
        onClick={handleClick}
        >
        <i className="fa fa-superscript" />
        </span>
    );
}

Math.align = 'left';
Math.pluginName = 'math';

export default Math;